﻿namespace PLCS.Domain.Solutions;

/// <summary>
/// 方案步骤表
/// </summary>
public class SolutionStep : BaseEntity
{
    /// <summary>
    /// 步骤号
    /// </summary>
    public string StepNo { get; init; }

    /// <summary>
    /// 步骤顺序
    /// </summary>
    public string StepOrder { get; set; }

    /// <summary>
    /// 工序（可能会有多个,用‘，’分隔）
    /// </summary>
    public string Process { get; set; }

    /// <summary>
    /// 最终工序，解析完获取
    /// </summary>
    public string? FinalProcess { get; set; }

    [NotMapped]
    public List<Process>? Processes { get; set; }

    public SolutionStep()
    {
    }

    public SolutionStep(string stepOrder, string process)
    {
        StepNo = Id.ToString();
        StepOrder = stepOrder;
        Process = process;

        if (!process.Contains(ConstantChar.SplitChar))
            FinalProcess = process;
    }
}